//
//  NEDViewController.m
//  NEDDBUserDefaults
//
//  Created by 0000 on 11/21/2021.
//  Copyright (c) 2021 0000. All rights reserved.
//

#import "NEDViewController.h"
#import "NEDDBSetting.h"
#import "NEDDBUserInfo.h"
#import <YYModel/NSObject+YYModel.h>

@interface NEDViewController ()

@end

@implementation NEDViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    
    [self logInfo];
    
    [self setSetting];
    [self setUserInfo];
    
    [self logInfo];
}

- (void)logInfo{
    
    NSLog(@"%@,%@",NEDDBUserInfo.sharedInstance,NEDDBSetting.sharedInstance);
    [self getUserInfo];
    [self getSetting];
}

- (void)getUserInfo{
    NSLog(@"username = %@",NEDDBUserInfo.sharedInstance.username);
    NSLog(@"userID = %@",NEDDBUserInfo.sharedInstance.userID);
}

- (void)getSetting{
    NSLog(@"firstOpen = %ld",(NSInteger)NEDDBSetting.sharedInstance.firstOpen);
    NSLog(@"firstOpenTime = %ld",NEDDBSetting.sharedInstance.firstOpenTime);
    
    NSLog(@"config = %@",[NEDDBSetting.sharedInstance.config yy_modelToJSONObject]);
}


- (void)setUserInfo{
    NEDDBUserInfo.sharedInstance.username = @"张三";
    NEDDBUserInfo.sharedInstance.userID = @"12KJHAISUYDUIQKHk";
}

- (void)setSetting{
    NEDDBSetting.sharedInstance.firstOpen = YES;
    NEDDBSetting.sharedInstance.firstOpenTime = 1231231231231;
    
    NEDConfig * config = [NEDConfig new];
    config.key = @"123aweqwe";
    config.path = @"pathapthaothpath";
    NEDDBSetting.sharedInstance.config = config;
}



- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
